package _ihm;
import javax.swing.*;

import src.Cell;
import src.Individu;
import src.Map;

import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;



public class ihm_cell extends JLabel {

	private int X;
	private int Y;
	private JLabel lbl;;
	private boolean Etat;
	private Map LaMap;
	private ihm_map uneIhmMap;

	public ihm_cell(int x, int y, Image Img, ihm_map IhmMap) {
		X=x;
		Y=y;
		this.uneIhmMap = uneIhmMap;
		this.LaMap = LaMap;
		lbl = new JLabel(new ImageIcon(Img)); 
		lbl.setPreferredSize(new Dimension(43,43));
		lbl.setMaximumSize(new Dimension(43,43));
		lbl.setMinimumSize(new Dimension(43,43));
		uneIhmMap=IhmMap;
		lbl.addMouseListener(new MouseAdapter() 
		{
			public void mousePressed(MouseEvent me)
			{
				
				if (ihm_Env.EnvMap.getCell(X, Y).getFond()!= null  &&  ihm_Env.EnvMap.getCell(X, Y).getIndividu() == null)
				{
					ihm_Env.EnvCell=ihm_cell.this;
				}
				else
					JOptionPane.showMessageDialog(null, "Cell de X: "+X+" et Y: "+Y+" Ajout Impossible");
            }
		});
	}
	public boolean isEtat() {
		return Etat;
	}

	public void setEtat(boolean etat) {
		Etat = etat;
	}
	public void addindividu (Individu Ind, int X, int Y){
		
	}
	
	public int getX() {
		return X;
	}

	public void setX(int x) {
		X = x;
	}

	public JLabel getLbl() {
		return lbl;
	}

	public void setLbl(JLabel lbl) {
		this.lbl = lbl;
	}
	
	public void setLblImg(Image img) {
		this.lbl.setIcon(new ImageIcon(img));
	}

	public int getY() {
		return Y;
	}

	public void setY(int y) {
		Y = y;
	}
	


}